package metalink;
import com.opensymphony.xwork2.ActionSupport;
import java.util.*;
import java.sql.*;

import org.apache.struts2.ServletActionContext;

import vo.*;
import vo.mixed.*;
import model.*;
import myutil.*;
import model.LoginMo;
import java.io.*;

import javax.servlet.http.HttpSession;
import model.*;

public class ImageUploader extends ActionSupport{
	
	File attached_file;
	String file_name;
	HttpSession sessioncheck;
	HttpSession session;
ArrayList<LoginInfoVo> imagelist=new ArrayList<LoginInfoVo>();
	

	public ArrayList<LoginInfoVo> getImagelist() {
		return imagelist;
	}

	public void setImagelist(ArrayList<LoginInfoVo> imagelist) {
		this.imagelist = imagelist;
	}
	public File getAttached_file() {
		return attached_file;
	}


	public void setAttached_file(File attached_file) {
		this.attached_file = attached_file;
	}


	public String getFile_name() {
		return file_name;
	}


	public void setFile_name(String file_name) {
		this.file_name = file_name;
	}


	public String execute(){
		LoginMo loginMo = new LoginMo();
		new ImageUploadMo().insertpicture(attached_file, file_name);
		session = ServletActionContext.getRequest().getSession();
		imagelist=loginMo.showImage(session.getAttribute("username").toString(), session.getAttribute("site_id").toString());
		return SUCCESS;
	}
}